GitHub 您所在的位置:网站首页 arduino softwareserial modbus GitHub

GitHub

#GitHub| 来源: 网络整理| 查看: 265

Tracer-RS485-Modbus-Blynk V2.0 - RELOADED An Arduino project to connect the EPSolar/EPEver Tracer A/B, Xtra, Triton Series MPPT Solar Controllers (RS-485 Modbus) to an ESP8266 and monitor it using the Blynk mobile app, the reloaded version!

This is almost complete rewrite of the original project, with ton of improvements, refactored code, brand new Blynk project, and wider compatibility of RS485 convertrs.

Feel free to make pull requests if you wish to help improving. There is also a support forum on the Blynk community forums: http://community.blynk.cc/t/epsolar-tracer-2210a-charge-controller-blynk-epic-solar-monitor/10596

Hardware

EPSolar/EPEver Tracer A/B-Series

RS485 UART Module (not the MAX485 chip! - @tekk: I'm using MAX485 cheapo module and it works fine!)

ESP8266 Dev Board

An old ethernet cable with RJ45 connector you are happy to cut open

Sample screenshot

Software Blynk Mobile App (iOS & Android) Arduino IDE 1.6.9+ The project sketch Wiring

Cut open your ethernet cable and split out pin 3, 5, 7 (B, A, GND). Refer to Tracer Modbus PDF for additional info.

Follow the wiring guide below: (note that the 2-pol switch is only needed during flashing) No longer needed!

Note: as @Don Vukovic noted, there is probably reversed RX and TX on this schematic. Correct is: DI to TX, and RO to RX

Setup Libraries

Follow links to get them.

Blynk Library ArduinoOTA SimpleTimer ModbusMaster Tutorial Edit esp_credentials.h library

Firstly, enter WiFi credentials in esp_credentials.h.

You will be able to use this file by including it in any sketch by entering #include . (This include is already present in settings.h, there's no need to add it.)

Example:

/************************************************************** * Settings - Wifi Credentials **************************************************************/ #define WIFI_SSID "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" #define WIFI_PASS "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Updated Blynk App V2.0 Open the Blynk mobile app and create a new project by scanning the following QR code

Send yourself the generated auth code Paste your auth code into esp_credentials.h: #define AUTH "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" Disconnect TX/RX cables (or open the switch if you have one) You don't have to do this anymore! But it's always best to have it disconnected. Upload the sketch to your ESP8266 Once uploaded, reconnect the TX/RX cables and plug the cable in to the Tracer COM port Just plug the ethernet cable to the Solar controller. Anyhow, it is always a good idea to repower the MAX485 module, if you're using one, between sketch uploads Load the Blynk project and hit PLAY button to start receiving data Reference

Tracer A/B Series MPPT Solar Controller - Modbus Protocol

MAX485 module:

I'm using this cheapo module and it works quite fine. It's powered from +5V from ESP8266, and wired as following:

MAX485 module ESP8266

DI -> D10 / GPIO1 / TX RO -> D9 / GPIO3 / RX DE and RE are interconnected with a jumper and then connected do eighter pin D1 or D2 VCC to +5V / VIN on ESP8266

Tracer A/B MPPT Controller Ethernet cable MAX485

Ethernet green, pin 5 -> A Ethernet blue, pin 3 -> B Ethernet brown, pin 7 -> GND on module and ESP8266 GND pin -> to prevent ground loops - important!

Developing further

I plan to add more features and pull more data from the controller once I have my own solar system running. If you'd like to pick this up and have a go at adding features, I'll be happy to accept pull requests.

You are welcome for suggestions, bugreports, and of course any further improvements of this code.

@tekk's V2 Changelog Rewrote whole sketch Tried to utilize HardwareSerial UART2 - no avail :( ModbusMaster library is incopatible with SoftwareSerial, (don't even try)... Would need to rewrite whole ModbusMaster, so Hardware UART is the only option for smooth & seamless communication because of the interrupt driven data transmission, more precise timing, and HW buffer, and stuff Optimized for very cheap MAX485 module, you can buy it from usual sources... Feature: Added option to switch the output of the Tracer MPPT Controller ON/OFF from the Blynk app Improvement: You no longer need to disconnect and reconnect Modbus RS485 Serial port from the ESP8266 while uploading Code rewrote to use as little magic constants as possible Added preTransmission abd postTransmission Modbus handling / signalling, just to be sure... Added calls to ESP.wdtDisable() and ESP.wdtEnable(1), temporary System Watchdog shutdown and later found it to be not necessarry Avoids unwanted rebooting of ESP8366 while receiving data from the Modbus Added more debug outputs and results to USB Serial Credits

@jaminNZx:

Thanks to subtafuge on Reddit for lending me his working Tracer RS485 code!

@tekk:

Feel free to contact me about my code changes in this version Thanks to @jaminNZx for the original code. Big up!


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有